<template>
	<view class="main">
		<u-navbar :is-back="true" :title="i18n.navbar.business_info" :background="background" :border-bottom="false"
			title-color="#000000" back-icon-color="#000">
			<view class="shop_info" slot="right" @click="router('../store_info/store_info')">
				{{i18n.business_info.store}}
			</view>
		</u-navbar>
		<view class="all">
			<view class="info">
				<view class="title">
					{{i18n.business_info.name}}
				</view>
				<text class="cont">{{info.name}}</text>
			</view>
			<view class="info">
				<view class="title">
					{{i18n.business_info.mailbox}}
				</view>
				<text class="cont">{{info.email}}</text>
			</view>
			<view class="info">
				<view class="title">
					{{i18n.business_info.phone}}
				</view>
				<text class="cont">{{info.phone}}</text>
			</view>
			<view class="info">
				<view class="title">
					{{i18n.business_info.username}}
				</view>
				<text class="cont">{{info.realName}}</text>
			</view>
			<view class="info">
				<view class="title">
					{{i18n.business_info.classification}}
				</view>
				<text class="cont">{{info.merCategory}}</text>
			</view>
			<view class="info">
				<view class="title">
					{{i18n.business_info.category}}
				</view>
				<text class="cont">{{info.isSelf==0?'非自营':'自营'}}</text>
			</view>
			<view class="info">
				<view class="title">
					{{i18n.business_info.type}}
				</view>
				<text class="cont">{{info.merType}}</text>
			</view>
			<view class="info">
				<view class="title">
					{{i18n.business_info.Servicecharge}}
				</view>
				<text class="cont">{{info.handlingFee}}</text>
			</view>
			<view class="info">
				<view class="title">
					{{i18n.business_info.additem}}
				</view>
				<text class="cont">需平台审核</text>
			</view>
			<view class="info">
				<view class="title">
					{{i18n.business_info.starlevel}}
				</view>
				<!-- star-fill -->
				<u-rate :count="count" v-model="info.starLevel" disabled="true" inactive-icon="star-fill"
					active-color="#FFA800">
				</u-rate>
			</view>
			<view class="info">
				<view class="title">
					{{i18n.business_info.time}}
				</view>
				<text class="cont">{{info.createTime}}</text>
			</view>
			<view class="info">
				<view class="title">
					{{i18n.business_info.qualification}}
				</view>
				<view class="info_img">
					<image v-for="(item,index) in imglist" :src="item" mode=""></image>
				</view>
			</view>
			<view class="info">
				<view class="title">
					{{i18n.business_info.open}}
				</view>
				<view @click="changeswith()">
					<u-switch v-model="info.isSwitch" size="32" inactive-color="#d6d6d6" ></u-switch>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				background: {
					backgroundColor: '#fff',
				},
				checked:false,
				count: 5, //评分个数
				info: '',
				shopinfo: '',
				imglist: []
			}
		},
		computed: {
			i18n() {
				return this.$t('message')
			},
		},
		onShow() {
			this.lang()
		},
		onLoad() {
			this.getconfiginfo()
			this.getinfo()
		},
		methods: {
			getinfo() {
				global.$http.request({
					url: '/api/admin/merchant/base/info',
					header: {
						'Authori-zation': uni.getStorageSync('token') //自定义请求头信息
					},
					method: 'GET',
				}).then(res => {
					if (res.data.code == 200) {
						console.log(res.data.data);
						this.info = res.data.data
						this.imglist = JSON.parse(this.info.qualificationPicture)
						console.log(this.imglist);
					}
				})
			},

			getconfiginfo() {
				global.$http.request({
					url: '/api/admin/merchant/config/info',
					header: {
						'Authori-zation': uni.getStorageSync('token') //自定义请求头信息
					},
					method: 'GET',
				}).then(res => {
					if (res.data.code == 200) {
						console.log(res.data.data);
						this.shopinfo = res.data.data
					}
				})
			},
			change(status) {
				console.log(status);
				this.changeswith()
			},
			changeswith() {
				// /api/admin/merchant/switch/update
				global.$http.request({
					url: '/api/admin/merchant/switch/update',
					header: {
						'Authori-zation': uni.getStorageSync('token') //自定义请求头信息
					},
				}).then(res => {
					if (res.data.code == 200) {
						uni.showToast({
							title: res.data.message,
							icon: 'none',
							duration: 500
						})

					}
				})
			},
			lang() {
				this._i18n.locale = uni.getStorageSync('select')
			},
			router(path) {
				console.log(1);
				uni.navigateTo({
					url: path
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		font-family: PingFang SC;
		background-color: #f7f7f7;

		.main {

			.shop_info {
				font-size: 30rpx;
				font-family: PingFang SC;
				font-weight: 400;
				color: #304156;
				padding-right: 19rpx;
			}

			.all {
				margin-top: 10rpx;

				.info {
					background-color: #fff;
					display: flex;
					align-items: center;
					justify-content: space-between;
					padding: 31rpx 22rpx;
					margin-bottom: 2rpx;

					.title {
						font-size: 28rpx;
						font-family: Source Han Sans CN;
						font-weight: 400;
						color: #000000;
					}

					.info_img {
						height: 110rpx;

						image {
							margin-left: 20rpx;
							width: 110rpx;
							height: 110rpx;
						}
					}

					.cont {
						font-size: 28rpx;
						font-family: Source Han Sans CN;
						font-weight: 400;
						color: #808080;
					}
				}
			}
		}
	}
</style>
